package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.domain.T18;
import com.ruoyi.service.IT18Service;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 客户管理员Controller
 * 
 * @author ruoyi
 * @date 2024-07-31
 */
@RestController
@RequestMapping("/adminaccount/T18")
public class T18Controller extends BaseController
{
    @Autowired
    private IT18Service t18Service;

    /**
     * 查询客户管理员列表
     */
    @PreAuthorize("@ss.hasPermi('adminaccount:T18:list')")
    @GetMapping("/list")
    @ApiOperation("列表")
    public TableDataInfo list(T18 t18)
    {
        startPage();
        List<T18> list = t18Service.selectT18List(t18);
        return getDataTable(list);
    }

    /**
     * 导出客户管理员列表
     */
    @PreAuthorize("@ss.hasPermi('adminaccount:T18:export')")
    @Log(title = "客户管理员", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, T18 t18)
    {
        List<T18> list = t18Service.selectT18List(t18);
        ExcelUtil<T18> util = new ExcelUtil<T18>(T18.class);
        util.exportExcel(response, list, "客户管理员数据");
    }

    /**
     * 获取客户管理员详细信息
     */
    @PreAuthorize("@ss.hasPermi('adminaccount:T18:query')")
    @GetMapping(value = "/{F1801}")
    public AjaxResult getInfo(@PathVariable("F1801") Long F1801)
    {
        return success(t18Service.selectT18ByF1801(F1801));
    }

    /**
     * 新增客户管理员
     */
    @PreAuthorize("@ss.hasPermi('adminaccount:T18:add')")
    @Log(title = "客户管理员", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody T18 t18)
    {
        return toAjax(t18Service.insertT18(t18));
    }

    /**
     * 修改客户管理员
     */
    @PreAuthorize("@ss.hasPermi('adminaccount:T18:edit')")
    @Log(title = "客户管理员", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody T18 t18)
    {
        return toAjax(t18Service.updateT18(t18));
    }

    /**
     * 删除客户管理员
     */
    @PreAuthorize("@ss.hasPermi('adminaccount:T18:remove')")
    @Log(title = "客户管理员", businessType = BusinessType.DELETE)
	@DeleteMapping("/{F1801s}")
    public AjaxResult remove(@PathVariable Long[] F1801s)
    {
        return toAjax(t18Service.deleteT18ByF1801s(F1801s));
    }
}
